package com.ruoyi.basedocument.domain;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

/**
 * 文件存储对象 t_bom_fileattstor
 * 
 * @author ruoyi
 * @date 2024-11-18
 */
public class BomFileattstor extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** ID */
    private String id;

    /** 来源单据id */
    @Excel(name = "来源单据id")
    private String sourceid;

    /** 文件名 */
    @Excel(name = "文件名")
    private String filename;

    /** 文件路径 */
    @Excel(name = "文件路径")
    private String filepath;

    /** 文件类型 */
    @Excel(name = "文件类型")
    private String filetype;

    /** 创建者 */
    @Excel(name = "创建者")
    private String creatorid;

    /** 创建时间 */
    private String createtime;

    public void setId(String id) 
    {
        this.id = id;
    }

    public String getId() 
    {
        return id;
    }
    public void setSourceid(String sourceid) 
    {
        this.sourceid = sourceid;
    }

    public String getSourceid() 
    {
        return sourceid;
    }
    public void setFilename(String filename) 
    {
        this.filename = filename;
    }

    public String getFilename() 
    {
        return filename;
    }
    public void setFilepath(String filepath) 
    {
        this.filepath = filepath;
    }

    public String getFilepath() 
    {
        return filepath;
    }
    public void setFiletype(String filetype) 
    {
        this.filetype = filetype;
    }

    public String getFiletype() 
    {
        return filetype;
    }
    public void setCreatorid(String creatorid) 
    {
        this.creatorid = creatorid;
    }

    public String getCreatetime() {
        return createtime;
    }

    public void setCreatetime(String createtime) {
        this.createtime = createtime;
    }

    public String getCreatorid()
    {
        return creatorid;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("sourceid", getSourceid())
            .append("filename", getFilename())
            .append("filepath", getFilepath())
            .append("filetype", getFiletype())
            .append("creatorid", getCreatorid())
            .toString();
    }

    public String getFileNameUtil(String path){
    String b = path.substring(path.lastIndexOf("/") + 1);
    String c = b.substring(0, b.indexOf("_"));
    String d = b.substring(b.lastIndexOf("."));
    return c + d;
}

    public String getFileTypeUtil(String path){
        return path.substring(path.lastIndexOf(".") + 1);
    }
}
